#include <iostream>
#include <algorithm>
#include <string>

using std::cout;
using std::endl;
using std::string;

int main()
{
    string s1 = "this is a string test";
    string s2 = "test";

    //可以用来查找字符串中的子串
    auto it = std::search(s1.begin(), s1.end(), s2.begin(), s2.end());
    if(it != s1.end()) {
        cout << "查找子串" << s2 << "成功";
        cout << "*it:" << *it << endl;
        s1.erase(it, s1.end());
        cout << "s1:" << s1 << endl;
    } else {
        cout << "查找失败" << endl;
    }

    return 0;
}

